﻿@model SettingsModel
@{
    ViewBag.Title = "网站设置";
}
@section css {
    <environment include="Development">
        <link href="~/lib/bootstrap-toggle/css/bootstrap-toggle.css" rel="stylesheet" />
    </environment>
    <environment exclude="Development">
        <link href="~/lib/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet" />
    </environment>
}
@section javascript {
    <environment include="Development">
        <script src="~/lib/validate/jquery.validate.js"></script>
        <script src="~/lib/validate/localization/messages_zh.js"></script>
        <script src="~/lib/bootstrap-toggle/js/bootstrap-toggle.js"></script>
    </environment>
    <environment exclude="Development">
        <script src="~/lib/validate/jquery.validate.min.js"></script>
        <script src="~/lib/validate/localization/messages_zh.min.js"></script>
        <script src="~/lib/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
    </environment>
    <script src="~/lib/longbow/longbow.dataentity.js"></script>
    <script src="~/lib/longbow/longbow.validate.js"></script>
    <script src="~/js/settings.js" asp-append-version="true"></script>
}
<div class="card" asp-auth="saveTitle">
    <div class="card-header">网站名称设置</div>
    <div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='title']">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改网站名称</span>
        </div>
        <div class="form-group">
            <div class="input-group">
                <input type="text" class="form-control" id="sysName" placeholder="请输入网站标题，50字以内" value="@Model.WebSiteTitle" maxlength="50" data-valid="true" />
                <div class="input-group-append" asp-condition="!@Model.IsDemo">
                    <button class="btn btn-secondary" type="button" data-method="title">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="card" asp-auth="saveFooter">
    <div class="card-header">网站页脚设置</div>
    <div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='footer']">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改网站页脚</span>
        </div>
        <div class="form-group">
            <div class="input-group">
                <input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚，50字以内" value="@Model.WebSiteFooter" maxlength="50" data-valid="true" />
                <div class="input-group-append" asp-condition="!@Model.IsDemo">
                    <button class="btn btn-secondary" type="button" data-method="footer">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="card">
    <div class="card-header"><label class="control-label" data-toggle="lgbinfo" data-content="通过此功能进行整个网站的登录界面设置">后台管理登录地址设置</label></div>
    <div class="card-body">
        <div class="form-group">
            <div class="form-group text-right">
                <div class="btn-group" role="group">
                    <div class="btn-group" role="group">
                        <button id="loginView" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" value="@Model.LoginView.Key">@Model.LoginView.Value</button>
                        <div class="dropdown-menu">
                            @foreach (var d in Model.Logins)
                            {
                                <a href="#" data-val="@d.Code">@d.Name</a>
                            }
                        </div>
                    </div>
                    <button class="btn btn-secondary" type="button" data-method="saveLoginView">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="card">
    <div class="card-header"><label class="control-label" data-toggle="lgbinfo" data-content="此功能给前台网站拼接后台功能菜单时使用">后台管理地址设置</label></div>
    <div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='appPath']">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改后台管理地址</span>
        </div>
        <div class="form-group">
            <div class="input-group">
                <input type="text" class="form-control flex-fill" id="sysAppPath" placeholder="请输入后台管理地址，2000字以内" value="@Model.AdminPathBase" maxlength="2000" data-valid="true" />
                <div class="input-group-append" asp-condition="!@Model.IsDemo">
                    <button class="btn btn-secondary" type="button" data-method="appPath">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="card" asp-auth="app">
    <div class="card-header">前台应用设置</div>
    <div class="card-body">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改前台应用设置</span>
        </div>
        <div class="form-inline">
            <div class="row" id="appList">
                @foreach (var app in Model.Apps)
                {
                    <div class="form-group col-12 app" data-key="@app.Key">
                        <label class="control-label" for="@app.Key">@app.Name</label>
                        <div class="input-group flex-fill">
                            <input id="@app.Key" class="form-control" value="@app.Url" readonly />
                            <div class="input-group-append" asp-condition="@(!Model.IsDemo)">
                                <button class="btn btn-danger" type="button" data-key="@app.Key" data-method="delApp"><i class="fa fa-trash-o"></i><span>删除</span></button>
                                <button class="btn btn-primary" type="button" data-key="@app.Key" data-method="editApp"><i class="fa fa fa-pencil"></i><span>编辑</span></button>
                            </div>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
    <div class="card-footer text-right" asp-condition="@(!Model.IsDemo)">
        <button class="btn btn-secondary" type="button" data-method="addApp"><i class="fa fa-plus"></i><span>新增</span></button>
    </div>
</div>
<div class="card" asp-auth="saveTheme">
    <div class="card-header">网站样式设置</div>
    <div class="card-body">
        <div class="alert alert-info" role="alert">
            <span>注意：<b><a class="badge-pill" href="./Profiles">个人中心</a></b>中设置的网站样式覆盖本设置</span>
        </div>
        <div class="form-group text-right">
            <div class="btn-group" role="group">
                <div class="btn-group" role="group">
                    <button id="dictCssDefine" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button>
                    <div class="dropdown-menu">
                        <a href="#" data-val="">默认样式</a>
                        @foreach (var css in Model.Themes)
                        {
                            <a href="#" data-val="@css.Code">@css.Name</a>
                        }
                    </div>
                </div>
                <button class="btn btn-secondary" type="button" data-method="css">保存</button>
            </div>
        </div>
    </div>
</div>
<div class="card" asp-auth="saveUISettings">
    <div class="card-header">网站功能设置</div>
    <div class="card-body">
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" for="sider">侧边栏设置</label>
                    <input id="sider" hidden type="checkbox" data-default-val="@Model.ShowSideBar" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="展开" data-off="收缩" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="cardTitle">标题设置</label>
                    <input id="cardTitle" hidden type="checkbox" data-default-val="@Model.ShowCardTitle" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="显示" data-off="关闭" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="tableHeader">固定表头</label>
                    <input id="tableHeader" hidden type="checkbox" data-default-val="@Model.FixedTableHeader" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="固定" data-off="跟随" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="health">健康检查</label>
                    <input id="health" hidden type="checkbox" data-default-val="@Model.EnableHealth" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right">
        <button data-method="UISettings" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="loginSettings">
    <div class="card-header">网站登录设置</div>
    <div class="card-body">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改网站登录设置</span>
        </div>
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" for="mobile">手机登录</label>
                    <input id="mobile" hidden type="checkbox" data-default-val="@Model.ShowMobile" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="允许" data-off="关闭" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="cardTitle">OAuth 认证</label>
                    <input id="oauth" hidden type="checkbox" data-default-val="@Model.ShowOAuth" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="允许" data-off="关闭" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right" asp-condition="!@Model.IsDemo">
        <button data-method="loginSettings" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="lockScreen">
    <div class="card-header">自动锁屏设置</div>
    <div class="card-body">
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" for="lockScreen">自动锁屏</label>
                    <input id="lockScreen" hidden type="checkbox" data-default-val="@Model.AutoLockScreen" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="lockPeriod">时长间隔(秒)</label>
                    <input id="lockPeriod" type="number" class="form-control" min="30" value="@Model.LockScreenPeriod" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right">
        <button data-method="saveAutoLock" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="defaultApp">
    <div class="card-header">默认应用设置</div>
    <div class="card-body">
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-12">
                    <label class="control-label" data-toggle="lgbinfo" data-content="开启此功能后登录时默认导航到第一个已授权的前台应用" for="defaultApp">默认应用</label>
                    <input id="defaultApp" hidden type="checkbox" data-default-val="@Model.DefaultApp" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right">
        <button data-method="saveDefaultApp" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="blazor">
    <div class="card-header">网站设置</div>
    <div class="card-body">
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" data-toggle="lgbinfo" data-content="开启此功能网站增加 Blazor 与 MVC 切换挂件" for="blazor">Blazor 切换</label>
                    <input id="blazor" hidden type="checkbox" data-default-val="@Model.EnableBlazor" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right">
        <button data-method="saveBlazor" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="iplocate">
    <div class="card-header">地址位置信息</div>
    <div class="card-body">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改地理信息配置</span>
        </div>
        <div class="form-group">
            <div class="btn-group" role="group">
                <button id="iplocator" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="None" value="@Model.IPLocatorSvr">@Model.IPLocatorSvr</button>
                <div class="dropdown-menu">
                    <a href="#" data-val="None">未设置</a>
                    @foreach (var ip in Model.IPLocators)
                    {
                        <a href="#" data-val="@ip.Code">@ip.Name</a>
                    }
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right" asp-condition="@(!Model.IsDemo)">
        <button data-method="saveIpLocator" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="logSettings">
    <div class="card-header">日志缓存设置</div>
    <div class="card-body">
        <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
            <span>演示系统禁止更改日志缓存设置</span>
        </div>
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" for="appErrorLog">异常日志(月)</label>
                    <input id="appErrorLog" type="number" class="form-control" min="1" value="@Model.ErrorLogPeriod" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="opLog">操作日志(月)</label>
                    <input id="opLog" type="number" class="form-control" min="1" value="@Model.OpLog" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="logLog">登录日志(月)</label>
                    <input id="logLog" type="number" class="form-control" min="1" value="@Model.LogLog" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="traceLog">访问日志(月)</label>
                    <input id="traceLog" type="number" class="form-control" min="1" value="@Model.TraceLog" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="cookiePeriod">Cookie(天)</label>
                    <input id="cookiePeriod" type="number" class="form-control" min="1" value="@Model.CookiePeriod" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="ipCachePeriod">IP 缓存(分)</label>
                    <input id="ipCachePeriod" type="number" class="form-control" min="1" value="@Model.IPCachePeriod" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right" asp-condition="@(!Model.IsDemo)">
        <button data-method="saveLogPeriod" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card" asp-auth="demo" data-toggle="LgbValidate" data-valid-button="[data-method='saveDemo']">
    <div class="card-header">演示系统设置</div>
    <div class="card-body">
        <div class="form-inline">
            <div class="row">
                <div class="form-group col-6">
                    <label class="control-label" data-toggle="lgbinfo" data-content="开启此功能网站切换至演示系统">演示系统</label>
                    <input id="demo" hidden type="checkbox" data-default-val="@Model.EnableDemo" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
                </div>
                <div class="form-group col-6">
                    <label class="control-label" for="authKey">授权码</label>
                    <input id="authKey" type="password" autocomplete="off" class="form-control" data-valid="true" />
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer text-right">
        <button data-method="saveDemo" class="btn btn-secondary" type="submit"><i class="fa fa-save"></i><span>保存</span></button>
    </div>
</div>
<div class="card">
    <div class="card-header">
        <div class="d-flex align-items-center">
            <span class="flex-fill">网站缓存设置</span>
            <a data-method="clear" href="#" class="fa fa-times-circle-o" title="全部清除" data-toggle="tooltip" data-placement="left" asp-auth="clearAllCache"></a>
            <a data-method="refresh" href="#" class="fa fa-refresh ml-3" title="点击刷新" data-toggle="tooltip"></a>
        </div>
    </div>
    <div class="card-body" id="sortable">
    </div>
</div>
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
        <div class="modal-content" data-toggle="LgbValidate" data-valid-button="[data-method='saveNewApp']" data-valid-modal="#dialogNew">
            <div class="modal-header">
                <h5 class="modal-title" id="myModalLabel">前台应用设置</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body">
                <form class="form-inline">
                    <div class="row">
                        <div class="form-group col-sm-6">
                            <input hidden id="appId" value />
                            <label class="control-label" for="appKey">应用ID</label>
                            <input type="text" class="form-control" id="appKey" placeholder="不可为空，50字以内" maxlength="50" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-6">
                            <input type="hidden" id="roleID" />
                            <label class="control-label" for="appName">应用名称</label>
                            <input type="text" class="form-control" id="appName" placeholder="不可为空，50字以内" maxlength="50" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="appUrl">应用首页</label>
                            <input type="text" class="form-control flex-fill" id="appUrl" placeholder="不可为空，2000字以内" maxlength="2000" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="appTitle">网站标题</label>
                            <input type="text" class="form-control flex-fill" id="appTitle" placeholder="不可为空，50字以内" maxlength="50" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="appFooter">网站页脚</label>
                            <input type="text" class="form-control flex-fill" id="appFooter" placeholder="不可为空，50字以内" maxlength="50" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="appIcon">网站图标</label>
                            <input type="text" class="form-control flex-fill" id="appIcon" placeholder="不可为空，2000字以内" maxlength="2000" data-valid="true" />
                        </div>
                        <div class="form-group col-sm-12">
                            <label class="control-label" for="appFavicon">favicon</label>
                            <input type="text" class="form-control flex-fill" id="appFavicon" placeholder="不可为空，2000字以内" maxlength="2000" data-valid="true" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">
                    <i class="fa fa-times"></i>
                    <span>关闭</span>
                </button>
                <button type="button" class="btn btn-primary" data-method="saveNewApp">
                    <i class="fa fa-save"></i>
                    <span>保存</span>
                </button>
            </div>
        </div>
    </div>
</div>